import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Test {

    public String toString() {
        System.out.print("aaa");
        return "bbb";
    }


    public static void main(String[] args) {
        Test test = new Test();
        System.out.println(test);
    }

    public static void main4(String[] args) {
        Date date = new Date();
        date.setDay(2025,03,06);
        date.printDay();
    }

    public static void main3(String[] args) {
        WashMachine washmachine = new WashMachine();
        washmachine.brand = "sakura";
        washmachine.type = "P27";
        washmachine.color = "white";
        System.out.println(washmachine.brand);
        System.out.println(washmachine.type);
        System.out.println(washmachine.color);
        washmachine.func();
        washmachine.func2();
    }

//    查找数组最大值和最小值
    public static void main2(String[] args) {
        Random random = new Random();
        int[] array = new int[10];
        for (int i = 0; i < array.length; i++) {
            int rnd = random.nextInt(100)+1;
            array[i] = rnd;
        }
        int max = array[0];
        int min = array[0];
        for (int num : array) {
            if(num > max){
                max = num;
            }
            if(num < min){
                min = num;
            }
        }
        System.out.println("生成的随机数组为："+ Arrays.toString(array));
        System.out.println("最大值为："+max);
        System.out.println("最小值为："+min);
    }

//    数组遍历与求和,定义一个整型数组并初始化，计算所有元素的总和与平均值
    public static void arraySum(int[] array){
        int sum = 0;
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        System.out.println("数组总和为："+sum);
        System.out.println("该数组的平均值为："+sum/array.length);
    }
    public static void main1(String[] args) {
        int[] array = {3, 5, 7, 2, 8};
        arraySum(array);
    }
}
